<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of imwrite2</title>
  <meta name="keywords" content="imwrite2">
  <meta name="description" content="Similar to imwrite, except follows a strict naming convention.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<!-- menu.html images -->
<h1>imwrite2
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Similar to imwrite, except follows a strict naming convention.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function I = imwrite2( I, multflag, imagei, path, name, ext, ndigits, varargin ) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Similar to imwrite, except follows a strict naming convention.

 Wrapper for imwrite that writes file to the filename:
   imagename = [path name int2str2(i,ndigits) '.' ext];
 Using imwrite: 
   imwrite( I, imagename, writeparams )

 If I represents a stack of images, the ith image is written to:
   imagenamei = [path name int2str2(i+imagei-1,ndigits) '.' ext];
   
 If I=[], then imwrite2 will attempt to read images from disk instead.

 multflag controls how I is interpreted.  If multflag==0, then I is intrepreted as a
 single image, otherwise I is interpreted as a stack of images, where I(:,:,...,j)
 represents the jth image (see feval_arrays for more info).

 If the directory specified by 'path' does not exist, imwrite2 attempts to create it.
 
 INPUTS
   I           - image or array or cell of images (if [] reads else writes)
   multflag    - set to 1 if I represents a stack of images
   imagei      - first image number
   path        - directory where images are
   name        - base name of images
   ext         - extension of image 
   ndigits     - number of digits for filename index
   writeparams - [varargin] additional parameters to imwrite

 OUTPUTS
   I           - image or images (read from disk if input I=[])

 EXAMPLE
   load images; clear IDXi IDXv t video videos;
   imwrite2( images(:,:,1), 0, 0, 'rats/', 'rats', 'png', 5 );    % writes first frame
   imwrite2( images(:,:,1:5), 1, 0, 'rats/', 'rats', 'png', 5 );  % writes first 5 frames
   images2 = imwrite2( [], 1, 0, 'rats/', 'rats', 'png', 5 );     % reads first 5 frames
   images2 = feval_images(@(x) x,{},'rats/','rats','png',0,4,5);  % reads first 5 frames

 DATESTAMP
   26-Jan-2005  2:00pm

 See also FEVAL_IMAGES, FEVAL_ARRAYS</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="../matlab/feval_arrays.html" class="code" title="function B = feval_arrays( A, fhandle, varargin )">feval_arrays</a>	Used to apply the same operation to a stack of array elements.</li><li><a href="../matlab/feval_images.html" class="code" title="function X = feval_images( fhandle, params, srcdir, name, ext, nstart, nend, ndigits )">feval_images</a>	Used to apply the same operation to all images in given directory.</li><li><a href="../matlab/int2str2.html" class="code" title="function nstr = int2str2( n, ndigits )">int2str2</a>	Convert integer to string of given length; improved version of int2str.</li></ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="imwrite2split.html" class="code" title="function I = imwrite2split( I, nSplits, spliti, path, varargin )">imwrite2split</a>	Writes/reads a large set of images into/from multiple directories.</li></ul>
<!-- crossreference -->



<hr><address>Generated on Wed 03-May-2006 23:48:50 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2003</address>
</body>
</html>